<?php 
    require_once("incl/functions/captcha.php"); 
    $captcha = new captcha();
?>
<div id="left">
    <span class="leftcontent">
        <?php
            if (isset($_SESSION['message'])){
                echo('<font color="red">' . $_SESSION['message'] . "</font>");
                unset ($_SESSION['message']);
            }
            // if something went wrong posting, the user gets to see an error message

            echo (GUEST_WELCOME);
            $noset = (GUEST_NOINPUT);

            // a welcome & no input message, based on your current language
        ?>
        
        <div id="guestbook">
            <?php
                $SQL = "SELECT date, time, name, message FROM guestbook_entry";
                $query = mysql_query($SQL);
                while($result = mysql_fetch_row($query)){
                    echo("<div id='comments'>date: " . $result[0] . "<br />" . $result[1] . "<br />name: " . $result[2] . "<br /><br />" . $result[3] . "<br /><br /></div>");
                }
            ?>
            <hr />
        </div>
    </span>
</div>
<div id="right">
    <form name="guestbook" method="POST" action="incl/functions/postcode.php">
        <?php echo CONTACT_WRITE; ?> 
        <textarea cols="50" rows="6" name="comment"></textarea><br />
        <?php echo CONTACT_NAME . "<input type='text' name='name'> *" . OPTIONAL; ?>
        <br />
        <div id="answerField">
            2+2=<input type="text" name="answerField" />
        </div>
        <br />
        <span id="captcha_guestbook">
            <?php $captcha->makeCaptcha(); ?>
        </span>
        <br /><br />
        <input type="submit" value="submit">
    </form>
</div>